package com.qf.springcloud.client;


import com.qf.springcloud.fallback.ProducerFallBack;
import com.qf.springcloud.fallback.ProducerFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

//  feign整合hystrix
@FeignClient(value = "PRODUCER",fallbackFactory = ProducerFallbackFactory.class)    // ip:port/producer/test
// 当前interface映射PRODUCER服务
public interface ProducerClient {

    @GetMapping("/producer/test")   // 通过SpringMVC注解去映射请求路径
    public String test();

    @GetMapping("/producer/test1/{id}")
    public String test1(@PathVariable(value = "id") String id);

    @PostMapping("/producer/test2")
    public String test2(@RequestParam(value = "name") String name, @RequestParam(value = "age") Integer age);

    @PostMapping("/producer/test3")
    public String test3(Map user);

}   